home *** CD-ROM | disk | FTP | other *** search
- COMINIT.COM ver:1.00 February 1992 by Paul B. Webster.
- ══════════════════════════════════════════════════════════════════════════
- COM port hardware
-
- You will virtually always be supplied with a COM port on purchase (or
- acquisition?) of a PC. And if you are operating Packet Radio or doing
- anything else even remotely interesting you will need at least two COM
- (serial) ports. These may be on a plug-in card, usually together with a
- parallel port using a chip especially designed to provide the parallel
- port while pampering (providing the baudrate clock for) the serial port
- chips. Alternatively they may be on a board which includes the Floppy
- Disk Controller, the Games (Joystick) port and a clock (in an XT) or even
- on the motherboard. A board which provides just a serial port is a rare
- animal nowadays!
-
- There may be a set of jumpers to select whether or not either or both
- ports are enabled, what addresses they appear at in the I/O map and what
- IRQ lines they use; or there may be only one or no jumpers: "take it or
- leave it". It is quite common to have one COM port fitted on a card with
- sockets for the chips to connect the second. In this case an expansion
- kit consisting of the Serial Port chip, RS-232 drivers and plug and cable
- assembly is quite easy to fit. The chip is usually an 8250 for a PC/XT
- and a 82450 or 16450 (or 88450 etc. etc) for an AT. While you are
- welcome to install a 16550, paKet 5 will not utilise its extra
- performance. Note that the latter chips are totally plug-in compatible
- swaps for the former; you can use a 16450 in your XT board. The extra
- RS-232 buffers (1488 and 1489) may be already soldered on the board (to
- total two 1488 and three 1489) and the second serial port plug (usually a
- 9-pin) may already be on the board so that only the chip need be added.
- A serial/multi-I/O card having square (about one inch) surface-mount
- chips usually has the second port built-in already and few jumper options.
-
- One jumper option of particular note is that to configure the port or
- ports as COM3 and/or COM4. Such a board can be used in addition to a
- fully-optioned dual-port or multi-I/O card to provide the third and
- fourth COM ports. There are a number of problems however including the
- Interrupt (IRQ) allocations mentioned later. The usual addresses of the
- COM1 and COM2 ports are $3F8 and $2F8 respectively ($ = Hexadecimal).
- Boards offering COM3 and COM4 usually allocate these at addresses $3E8
- and $2E8 but some use other addresses. By and large however if a board
- has jumper options which are documented (you DO have the leaflet for the
- board?) or marked on the PCB as either COM3 and COM4 or "3E8" and "2E8"
- then these may be selected and the board plugged in additional to the
- already fitted COM1 and COM2 board.
-
- Finally, Telephone Modem cards ("in-modems") contain a single serial port
- chip as part of the interface with jumpers to select the address ("COM1"
- to "COM4") and IRQ.
-
-
- Recognising COM3 and COM4
-
- To be frank, the BIOS provides a virtually unusable interface to the COM
- ports, adequate only for the original purpose of connecting a serial
- printer to the PC. paKet however (as with all communications programs)
- contains complete code for both outputting data to the COM port and
- (where BIOS is deficient) inputting data from the port as it arrives. To
- do this latter, it uses the Interrupt function of the 8250/16450 Serial
- Port chip to the PC bus. It thus becomes necessary to ensure the "IRQ"
- lines are correctly arranged.
-
- First things first though. The (COM) ports must be accessible via their
- I/O (input/output) addresses and so paKet must KNOW these addresses. It
- does so via DOS's (or more correctly, the BIOS) "Equipment List" which
- reserves four addresses (memory locations $0000:0400 to 0407 to be exact)
- to be COM1 to COM4. These addresses if "empty" are zero. BIOS performs
- a search routine on boot-up to see if a COM port exists at certain
- addresses. PC/XT and AT BIOS looks at two addresses and "installs" as
- many as found into the Equipment list. SX/DX(80386) BIOS looks at at
- least four addresses and installs up to the full four. The accessory
- program "COMINIT.COM" looks at up to eight plausible addresses to find
- COM ports and installs up to four. It can therefore be used to find and
- install extra COM ports in a PX/XT/AT system and maybe in a 386 etc..
-
- Note one particular thing: BIOS or COMINIT search addresses in a certain
- order and install ports as found into the Equipment List. COM1 to COM4
- are names of positions in the Equipment List, not names of addresses.
- COM1 does NOT mean "address $3F8". If for example a "COM3/COM4" board is
- the only serial port board in the system, it becomes COM1 and COM2
- whatever its addresses. If a "COM3" board is added to a system with one
- only previous COM port; it becomes COM2.
-
- paKet will only allow selection of COM ports that exist in the Equipment
- List at the time. In fact if the Equipment list somehow contains COM1
- and COM3 but no COM2, or COM1, COM2 and COM4, then these ports and these
- only may be selected.
-
- Sharing interrupts
-
- Some cards offer only IRQ4 and IRQ3 for the com ports (these are the
- standard allocations for COM1 and COM2 respectively) while others offer
- IRQ2,3,4 and 5 or maybe... There are problems when more than one port
- uses or "shares" the same interrupt, so some software uses all four of
- these interrupts if a four-port card is used. As long as nothing ELSE
- needs to use interrupts 2 and 5 that is.
-
- For paKet, the accepted "standard" is followed that COM1 and COM3 use if
- not share IRQ4 while COM2 and COM4 use IRQ3. If the port that BIOS
- allocates to a particular COM port in the Equipment List does not have
- its IRQ set to the corresponding value, it WILL NOT WORK (to be precise
- in paKet it will output but fail to input data). COMINIT may be used to
- report the address allocations of the installed COM ports to locate the
- offending jumpers (if they exist).
-
- Now it may be that you have a mouse on COM1, a telephone modem on COM2,
- and have installed COM3 to run paKet. COM1 and COM3 both use the same
- interrupt line; the mouse is using that line because it is interrupt-
- driven and paKet needs to use the line as it too is interrupt-
- dependent. There will be a clash as both serial port IRQ drivers are
- enabled and paralleled to the same IRQ line (IRQ4 in the example). A
- method of resolving this is to replace the IRQ select jumper in BOTH
- boards; that for COM1 and that for COM3 in this case; with a parallel
- diode and resistor.
-
- This is most conveniently done by preparing a two-pin socket from a
- length of pin-socket strip or from an IC socket (using a SHARP craft
- knife). The resistor (1K ohm) and diode (Silicon or Schottky signal
- diode) are soldered in parallel to the socket piece at right angles to
- the pins so that they do not foul the adjacent slot card (trim the socket
- pins, too), and fitted in place of the original jumper so that the diode
- cathode (band) is to the pin which leads to the motherboard. On a 3-pin
- jumper where the three pins are "IRQ3-common-IRQ4", the diode cathode
- faces AWAY from the common centre pin.
-
- Where DIP switches are used for the selection, the diode and resistor may
- be soldered behind the board across the switch which would otherwise be
- closed to make the IRQ selection and the switch left open; again so the
- cathode faces the IRQ lines to the edge connector and the anode to the
- common selection line for the particular port.
-
- For boards without the IRQ jumpers, a little ingenuity is called for.
-
- This arrangement comprises a diode-resistor OR gate where the two (or
- possibly more) IRQ sources are OR'ed to the IRQ line. Either diode will
- pull the line high, or both resistors will pull it low. paKet is coded
- so that if on an interrupt it fails to find the serial chip has actually
- generated one, it will "fall through" to the interrupt vector in
- operation before paKet was executed. If as in the example given, a mouse
- has been installed on COM1, paKet using COM3 will check all interrupts on
- IRQ4 and pass on to the mouse driver those which do not represent a
- character received on COM3. It is possible to use via the "F9 DOS call"
- a program which uses the mouse but see below.
-
- Limitations
-
- If the "Wired-OR" modification detailed above is implemented, please
- remember that paKet is unusual in that it will pass on IRQ interrupts not
- its own to a previously loaded program (usually a driver). You cannot
- expect that other programs will do this, so DO NOT run from the "F9"
- function any program that uses either paKet's current COM port or that
- port's IRQ line. A mouse can share an IRQ line only if the mouse driver
- is loaded beforehand (though the program that USES the driver might be
- run from the "F9" function).
-
- Finally, the modification only guarantees that the two ports sharing the
- IRQ can be simultaneously enabled. Unfortunately, there remains a risk
- that if both ports are simultaneously receiving information, such as
- paKet being sent information from the TNC whilst the mouse is being
- moved, interrupts from both ports will on occasion arrive within the time
- it takes for them to be serviced and only one will in fact be serviced.
- The unserviced port will then "hang" both ports. A design "feature" of
- the 8259 interrupt controller in the PC prevents it from detecting this
- condition (which could also occur on a single port in a slow sytem at a
- high baudrate). If this happens, both ports will fail to receive data.
- Data can still be sent to the TNC so paKet may be exited successfully.
- Exiting from paKet may or may not clear the hangup (try out the mouse);
- if it does not the system will have to be reset. Note that this will NOT
- hang any other part of the system; only the ports using that IRQ.
- You might get away with this arrangement using a lower baudrate.
-
-
-
- The COMINIT Program
-
- This utility attempts to locate COM ports beyond the first two installed
- by the PC/XT/AT BIOS and install them in DOS's Equipment List to suit
- paKet (or any other comms program supporting COM3 and COM4). There are
- four slots available in all, thus COM1 to COM4. Generic SX (80386) BIOS
- appears to attempt to fill all four slots, though I cannot vouch for
- what assumptions it makes in the process.
-
- There are no options; simply invoke it as:
- COMINIT
-
- Having verified that it performs the desired function, include it in
- your AUTOEXEC.BAT file.
-
- ──────────────────────────────────────────────────────────────────────────
-
- What assumptions does COMINIT make? Well, it looks at the following
- addresses: $3F8, $2F8, $3E8, $2E8, $2E0, $3E0, $2F0, and $260.
-
- It assumes that these addresses will alternately use IRQ4 and IRQ3.
- Since paKet assumes that COM1 and COM3 use IRQ4 whilst COM2 and COM4 use
- IRQ3, COMINIT will not bother to install port addresses in unsuitable
- COM "slots". Nor will it attempt to re-install a port in an suitable
- slot if it finds it already installed in an "unsuitable" one; it just
- reports where it has found it.
-
- Note that this initial version ASSUMES use of certain IRQ channels, it
- does not test this (but an upgrade will do just that). To summarise:
-
- COM1, COM3 »» IRQ4 «« ports $3F8, $3E8, $2E0 or $2F0
- COM2, COM4 »» IRQ3 «« ports $2F8, $2E8, $3E0 or $260.
-
- Certain interesting things will be evident about COMINIT. If you run it
- twice, it will of course perform no installations the second time, but
- will report all the previous allocations as it will of course if the
- allocations have been made in some other manner.
-
- It will just as happily install COM1 and/or COM2 if these were not
- installed on initialisation. If for example a dual port board with the
- $3E8 and $2E8 addresses is fitted as the only COM ports, the (XT/AT)
- BIOS will take no notice of it, but COMINIT will install it as COM1 and
- COM2.
-
- ──────────────────────────────────────────────────────────────────────────
-
- If you have any problems with COM ports, including the "sharing" of
- interrupts you are quite welcome to forward enquiries to me, Paul,
- VK2BZC @ VK2ATM.NSW.AUS.OC.
-
- Cheers!
-